Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jacques/evaluate prompt #1023

Merged
merged 28 commits into from
Jan 14, 2025
Merged

Jacques/evaluate prompt #1023

merged 28 commits into from
Jan 14, 2025

Conversation

jverre
Copy link
Collaborator

@jverre jverre commented Jan 12, 2025

Details

Updated the evaluation documentation and fixed various issues in the docs

@jverre jverre requested review from a team as code owners January 12, 2025 18:54
@jverre jverre requested review from a team as code owners January 12, 2025 19:15
sdks/python/examples/evaluate_prompt.py Outdated Show resolved Hide resolved
processed_messages.append(
{
"role": message["role"],
"content": pystache.render(message["content"], prompt_variables),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use opik.api_objects.prompt.prompt_template.PromptTemplate class. It does pretty much the same stuff as pystache and has special errors for the cases when variables don't match the template.

Copy link
Collaborator Author

@jverre jverre Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated but I had to turn off the validation since we only want the validation only if one of the variables in the prompt is not updated. But at least we don't have an extra dependency


verbose: an integer value that controls evaluation output logs such as summary and tqdm progress bar.
"""
if isinstance(model, str):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if isinstance(model, str):
    model = models_factory.get(model_name=model)
elif not isinstance(model, base_model.OpikBaseModel):
    raise ValueError("`model` must be either a string or an OpikBaseModel instance")

sdks/python/src/opik/evaluation/evaluator.py Outdated Show resolved Hide resolved
sdks/python/src/opik/evaluation/evaluator.py Outdated Show resolved Hide resolved
sdks/python/src/opik/evaluation/evaluator.py Outdated Show resolved Hide resolved
@jverre jverre requested a review from alexkuzmik January 13, 2025 20:47
alexkuzmik
alexkuzmik previously approved these changes Jan 14, 2025
@alexkuzmik alexkuzmik merged commit ddf0b85 into main Jan 14, 2025
72 of 74 checks passed
@alexkuzmik alexkuzmik deleted the jacques/evaluate_prompt branch January 14, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants